/*
 * @Description: 数据模型
 * @Autor: HuiSir<www.zuifengyun.com>
 * @Date: 2022-05-31 11:30:02
 * @LastEditTime: 2022-06-10 19:03:35
 */
import SQLAgent, { ISchema } from '../helper/SQLAgent.js'
import useMysqlPool from './useMysqlPool.js'

/**
 * 导出模型
 * @param tableName 表名
 * @param Schema 表架构
 * @param WorkerId 机器码，数字，范围[1,63] 不同的微服务可配置不同的机器码
 */
export default (tableName: string, Schema: ISchema, WorkerId: number = 1) => {
    const pool = useMysqlPool()
    return new SQLAgent(pool, tableName, Schema, WorkerId)
}